Application.SaveDocument()
dim ws
set ws = CreateObject("WScript.Shell")
dim varName : varName = "PADS_SHORTCUT_ROOT"
dim regPath : regPath ="HKEY_CURRENT_USER\Software\MyApp\PADS\" & varName
dim varValue : varValue = ws.RegRead(regPath)
dim ocmd
ocmd = "cscript """ & varValue & "\scripts\now.vbs"""	
ws.run ocmd, 0, False
varName = "NOW"
regPath ="HKEY_CURRENT_USER\Software\MyApp\PADS\" & varName
varValue =ws.RegRead(regPath)
set ws = nothing
dim nowStr
nowStr = varValue	

Dim doc
Set doc = application.ActiveDocument
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject") 
dim bakfolder
bakfolder = doc.path & "\bak"
if fso.folderexists(bakfolder)=false then
	fso.createfolder bakfolder
end if

dim sourcefile,desfile
sourcefile = doc.path & "\" & doc.name
dim pcbname
pcbname = left(doc.name,len(doc.name)-4)
desfile = doc.path & "\bak\" & pcbname & "_" & nowStr &"_copy.pcb"
fso.copyfile(sourcefile,desfile)
set fso = nothing

